package cn.collin.commons.domain;

import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * 系统字典
 * 
 * @author collin.code@gmail.com
 * @hibernate.class table="COLLIN_HIER_INFO"
 * 
 */
public class SysHierInfo {
	/**
	 * 唯一id
	 * 
	 * @hibernate.id column="ID" generator-class="identity" type="long"
	 */
	Long id;

	/**
	 * 编码（唯一性）
	 * 
	 * @hibernate.property column="CODE" type="string"
	 */

	String code;

	/**
	 * 父id
	 * 
	 * @hibernate.property column="PARENT_ID" type="long"
	 */

	Long parentId;

	/**
	 * 排序号
	 * 
	 * @hibernate.property column="NO" type="integer"
	 * 
	 */
	Integer no;

	/**
	 * 名称
	 * 
	 * @hibernate.property column="NAME" type="string"
	 * 
	 */
	String name;

	/**
	 * 说明
	 * 
	 * @hibernate.property column="DESCRIPTION" type="string"
	 * 
	 */
	String description;

	/**
	 * 子
	 * 
	 * @hibernate.set cascade="delete"
	 * @hibernate.key column="PARENT_ID"
	 * @hibernate.one-to-many class="cn.collin.commons.domain.SysHierInfo"
	 */
	Set<SysHierInfo> children;

	public SysHierInfo() {

	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public Integer getNo() {
		return no;
	}

	public void setNo(Integer no) {
		this.no = no;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Set<SysHierInfo> getChildren() {
		return children;
	}

	public void setChildren(Set<SysHierInfo> children) {
		this.children = children;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof SysHierInfo)) {
			return false;
		}
		SysHierInfo rhs = (SysHierInfo) object;
		return new EqualsBuilder().append(this.id, rhs.id).isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(1960775965, -578237043).append(this.id)
				.toHashCode();
	}
}
